﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ArticleList.aspx.cs" Inherits="LongSpeed.WebSite.Main.Admin.ArticleList" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>久速科技 — 文章管理 </title>
    <script src="../../Scripts/admindesktop.js" type="text/javascript"></script>
    <script src="../../../Scripts/ueditor/editor_config.js" type="text/javascript"></script>
    <script src="../../../Scripts/ueditor/editor_all.js" type="text/javascript"></script>
    <link href="../../../Scripts/ueditor/themes/default/ueditor.css" rel="stylesheet"
        type="text/css" />
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <ext:Viewport runat="server" ID="vpArticle" Layout="BorderLayout">
        <Items>
            <ext:Panel Region="North" runat="server" ID="plPart" BaseCls="x-plain" />
            <ext:GridPanel ID="ArticleGridPanel" runat="server" Region="Center" Height="500"
                Icon="Script">
                <LoadMask Msg="正在加载数据…" ShowMask="true" />
                <Store>
                    <ext:Store ID="ArticleStore" runat="server" OnRefreshData="RefreshArticleData">
                        <Reader>
                            <ext:JsonReader>
                                <Fields>
                                    <ext:RecordField Name="ID" Type="Int" />
                                    <ext:RecordField Name="Title" Type="String" />
                                    <ext:RecordField Name="Content" Type="String" />
                                    <ext:RecordField Name="ReleaseDate" Type="String" />
                                    <ext:RecordField Name="Part" Type="String" />
                                    <ext:RecordField Name="FromUrl" Type="String" />
                                    <ext:RecordField Name="UrlMappingId" Type="Int" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel3" runat="server">
                    <Columns>
                        <ext:RowNumbererColumn />
                        <ext:Column Header="标题" DataIndex="Title" Width="250" />
                        <ext:Column Header="发布日期" DataIndex="ReleaseDate" Width="150" />
                        <ext:Column Header="Url路径" DataIndex="FromUrl" />
                        <ext:Column Header="备注" Width="150" DataIndex="Memo" />
                        <ext:CommandColumn Width="150" Header="操作">
                            <Commands>
                                <ext:GridCommand Icon="NoteEdit" CommandName="Edit" Text="编辑" />
                                <ext:GridCommand Icon="Delete" CommandName="Delete" Text="删除" />
                            </Commands>
                        </ext:CommandColumn>
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel3" runat="server" />
                </SelectionModel>
                <LoadMask ShowMask="true" Msg="正在加载数据……" />
                <TopBar>
                    <ext:Toolbar ID="Toolbar3" runat="server">
                        <Items>
                            <ext:ToolbarFill ID="ToolbarFill3" runat="server" />
                            <ext:Button ID="Button9" runat="server" Text="新建" Icon="Add">
                                <Listeners>
                                    <Click Handler="NewData(EditArticleFrom,EditArticleWin,ArticleGridPanel)" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <BottomBar>
                    <ext:PagingToolbar ID="PagingToolbar3" runat="server" PageSize="25">
                        <Items>
                            <ext:ToolbarSpacer ID="ToolbarSpacer5" runat="server" Width="10" />
                            <ext:Label ID="Label3" runat="server" Text="分页大小:" />
                            <ext:ToolbarSpacer ID="ToolbarSpacer6" runat="server" Width="5" />
                            <ext:ComboBox ID="ComboBox3" runat="server" Width="80">
                                <Items>
                                    <ext:ListItem Text="10" />
                                    <ext:ListItem Text="15" />
                                    <ext:ListItem Text="25" />
                                </Items>
                                <SelectedItem Value="10" />
                                <Listeners>
                                    <Select Handler="#{PagingToolbar1}.pageSize = parseInt(this.getValue()); #{PagingToolbar1}.doLoad();" />
                                </Listeners>
                            </ext:ComboBox>
                        </Items>
                    </ext:PagingToolbar>
                </BottomBar>
                <Listeners>
                    <Command Handler="GridPanelRowCommand(this,command, record,EditArticleFrom,EditArticleWin,vpArticle);" />
                </Listeners>
            </ext:GridPanel>
        </Items>
    </ext:Viewport>
    <ext:Window runat="server" ID="EditArticleWin" Title="新闻 - 编辑/详情" Icon="Pencil" Modal="true"
        Width="800" Hidden="true" Height="450" Maximized="true" Draggable="false">
        <Content>
            <ext:FormPanel ID="EditArticleFrom" Frame="true" LabelAlign="Right" runat="server"
                Padding="10">
                <Items>
                    <ext:TextField runat="server" FieldLabel="标题" DataIndex="Title" AnchorHorizontal="100%" />
                    <ext:TextField runat="server" FieldLabel="Url路径" DataIndex="FromUrl" AnchorHorizontal="100%" Regex="^[a-z0-9A-Z]+[_\-]?[a-z0-9A-Z]+.html$" BlankText="输入Url格式不正确"  />
                    <ext:TextField runat="server" FieldLabel="Url映射ID" DataIndex="UrlMappingId" Hidden="true" />
                    <ext:TextArea runat="server" FieldLabel="内容" DataIndex="Content" ID="editorC" AutoScroll="true" AnchorHorizontal="100%" Height="465" />
                    <ext:TextField runat="server" FieldLabel="备注" DataIndex="Memo" AnchorHorizontal="100%" />
                </Items>
            </ext:FormPanel>
        </Content>
        <Buttons>
            <ext:Button ID="Button20" runat="server" Text="保存" Icon="Disk">
                <Listeners>
                    <Click Handler="#{EditArticleFrom}.getForm().updateRecord(EditArticleFrom.record); SaveData(3,EditArticleFrom,false,EditArticleWin,ArticleGridPanel) ;" />
                </Listeners>
            </ext:Button>
            <ext:Button ID="Button21" runat="server" Text="新建" Icon="PencilAdd">
                <Listeners>
                    <Click Handler="SaveData(3,EditArticleFrom,true,EditArticleWin,ArticleGridPanel) ;" />
                </Listeners>
            </ext:Button>
            <ext:Button ID="Button22" runat="server" Text="重置">
                <Listeners>
                    <Click Handler="#{EditArticleFrom}.getForm().reset();" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>
    <script type="text/javascript">
        var desEditor;

        window.onload = function () {

            Ext.onReady(function () {
                var editor = baidu.editor.ui.Editor({
                    textare: "myValue"
                });
                editor.render("editorC");
                desEditor = editor;
            });
        }
        //获得 editor.getContent()
        //赋值 editor.setContent("")

    </script>
    </form>
</body>
</html>
